Extends: MessageTray.Source,
_init: function() {
- this.parent(_("Removable Devices"));
+ this.parent(_("Removable Devices"), 'media-removable', St.IconType.FULLCOLOR);
this._mounts = [];
this._notification = new AutorunResidentNotification(this);
- this._setSummaryIcon(this.createNotificationIcon());
},
addMount: function(mount, apps) {
Main.messageTray.add(this);
this.pushNotification(this._notification);
}
- },
-
- createNotificationIcon: function() {
- return new St.Icon ({ icon_name: 'media-removable',
- icon_type: St.IconType.FULLCOLOR,
- icon_size: this.ICON_SIZE });
}
});
Extends: MessageTray.Source,
_init: function(mount, apps) {
- this.parent(mount.get_name());
-
this.mount = mount;
this.apps = apps;
+ this.parent(mount.get_name());
+
this._notification = new AutorunTransientNotification(this);
this._setSummaryIcon(this.createNotificationIcon());
Extends: MessageTray.Source,
_init: function(keyboard) {
- this.parent(_("Keyboard"));
this._keyboard = keyboard;
-
- this._setSummaryIcon(this.createNotificationIcon());
- },
-
- createNotificationIcon: function() {
- return new St.Icon({ icon_name: 'input-keyboard',
- icon_type: St.IconType.SYMBOLIC,
- icon_size: this.ICON_SIZE });
+ this.parent(_("Keyboard"), 'input-keyboard', St.IconType.SYMBOLIC);
},
handleSummaryClick: function() {
Extends: Source,
_init: function() {
- this.parent(_("System Information"));
-
- this._setSummaryIcon(this.createNotificationIcon());
- },
-
- createNotificationIcon: function() {
- return new St.Icon({ icon_name: 'dialog-information',
- icon_type: St.IconType.SYMBOLIC,
- icon_size: this.ICON_SIZE });
+ this.parent(_("System Information"), 'dialog-information', St.IconType.SYMBOLIC);
},
open: function() {
}
this.parent();
+ },
+
+ createNotificationIcon: function() {
+ // We set the summary icon ourselves.
+ return null;
}
});
this.parent(strings[0]);
this._notification = new ShellMountPasswordNotification(this, strings, icon, reaskPassword);
+ this._setSummaryIcon(icon);
// add ourselves as a source, and popup the notification
Main.messageTray.add(this);
_ensureSource: function() {
if (!this._source) {
- this._source = new Source();
+ this._source = new MessageTray.Source(_("Bluetooth"), 'bluetooth-active', St.IconType.SYMBOLIC);
Main.messageTray.add(this._source);
}
},
}
});
-const Source = new Lang.Class({
- Name: 'BluetoothSource',
- Extends: MessageTray.Source,
-
- _init: function() {
- this.parent(_("Bluetooth"));
-
- this._setSummaryIcon(this.createNotificationIcon());
- },
-
- notify: function(notification) {
- this._private_destroyId = notification.connect('destroy', Lang.bind(this, function(notification) {
- if (this.notification == notification) {
- // the destroyed notification is the last for this source
- this.notification.disconnect(this._private_destroyId);
- this.destroy();
- }
- }));
-
- this.parent(notification);
- },
-
- createNotificationIcon: function() {
- return new St.Icon({ icon_name: 'bluetooth-active',
- icon_type: St.IconType.SYMBOLIC,
- icon_size: this.ICON_SIZE });
- }
-});
-
const AuthNotification = new Lang.Class({
Name: 'AuthNotification',
Extends: MessageTray.Notification,
_ensureSource: function() {
if (!this._source) {
- this._source = new NMMessageTraySource();
+ this._source = new MessageTray.Source(_("Network Manager"),
+ 'network-transmit-receive',
+ St.IconType.SYMBOLIC);
+
this._source.connect('destroy', Lang.bind(this, function() {
this._source = null;
}));
}
}
});
-
-const NMMessageTraySource = new Lang.Class({
- Name: 'NMMessageTraySource',
- Extends: MessageTray.Source,
-
- _init: function() {
- this.parent(_("Network Manager"));
-
- let icon = new St.Icon({ icon_name: 'network-transmit-receive',
- icon_type: St.IconType.SYMBOLIC,
- icon_size: this.ICON_SIZE
- });
- this._setSummaryIcon(icon);
- }
-});
_ensureSubscriptionSource: function() {
if (this._subscriptionSource == null) {
- this._subscriptionSource = new MultiNotificationSource(
- _("Subscription request"), 'gtk-dialog-question');
+ this._subscriptionSource = new MessageTray.Source(_("Subscription request"),
+ 'gtk-dialog-question',
+ St.IconType.FULLCOLOR);
Main.messageTray.add(this._subscriptionSource);
this._subscriptionSource.connect('destroy', Lang.bind(this, function () {
this._subscriptionSource = null;
_ensureAccountSource: function() {
if (this._accountSource == null) {
- this._accountSource = new MultiNotificationSource(
- _("Connection error"), 'gtk-dialog-error');
+ this._accountSource = new MessageTray.Source(_("Connection error"),
+ 'gtk-dialog-error',
+ St.IconType.FULLCOLOR);
Main.messageTray.add(this._accountSource);
this._accountSource.connect('destroy', Lang.bind(this, function () {
this._accountSource = null;
Extends: MessageTray.Source,
_init: function(account, conn, channel, contact, client) {
- this.parent(contact.get_alias());
-
this.isChat = true;
this._account = account;
this._contact = contact;
this._client = client;
+ this.parent(contact.get_alias());
+
this._pendingMessages = [];
this._conn = conn;
this._receivedId = this._channel.connect('message-received', Lang.bind(this, this._messageReceived));
this._pendingId = this._channel.connect('pending-message-removed', Lang.bind(this, this._pendingRemoved));
- this._setSummaryIcon(this.createNotificationIcon());
-
this._notifyAliasId = this._contact.connect('notify::alias', Lang.bind(this, this._updateAlias));
this._notifyAvatarId = this._contact.connect('notify::avatar-file', Lang.bind(this, this._updateAvatarIcon));
this._presenceChangedId = this._contact.connect('presence-changed', Lang.bind(this, this._presenceChanged));
Extends: MessageTray.Source,
_init: function(dispatchOp, text, gicon) {
- this.parent(text);
-
this._gicon = gicon;
- this._setSummaryIcon(this.createNotificationIcon());
+
+ this.parent(text);
this._dispatchOp = dispatchOp;
createNotificationIcon: function() {
return new St.Icon({ gicon: this._gicon,
- icon_type: St.IconType.FULLCOLOR,
icon_size: this.ICON_SIZE });
}
});
}
});
-// A notification source that can embed multiple notifications
-const MultiNotificationSource = new Lang.Class({
- Name: 'MultiNotificationSource',
- Extends: MessageTray.Source,
-
- _init: function(title, icon) {
- this.parent(title);
-
- this._icon = icon;
- this._setSummaryIcon(this.createNotificationIcon());
- this._nbNotifications = 0;
- },
-
- notify: function(notification) {
- this.parent(notification);
-
- this._nbNotifications += 1;
-
- // Display the source while there is at least one notification
- notification.connect('destroy', Lang.bind(this, function () {
- this._nbNotifications -= 1;
-
- if (this._nbNotifications == 0)
- this.destroy();
- }));
- },
-
- createNotificationIcon: function() {
- return new St.Icon({ gicon: Gio.icon_new_for_string(this._icon),
- icon_type: St.IconType.FULLCOLOR,
- icon_size: this.ICON_SIZE });
- }
-});
-
// Subscription request
const SubscriptionRequestNotification = new Lang.Class({
Name: 'SubscriptionRequestNotification',
Extends: MessageTray.Source,
_init: function(app, window) {
- this.parent(app.get_name());
this._window = window;
this._app = app;
- this._setSummaryIcon(this.createNotificationIcon());
+
+ this.parent(app.get_name());
this.signalIDs = [];
this.signalIDs.push(this._window.connect('notify::demands-attention', Lang.bind(this, function() { this.destroy(); })));